Character access
By accessing the index of string by wrapping index inside square brackets syntax [], we can access string at particular positions.
For example,
let word = "JavaScript";
word[0]; // first character
word[1]; // second character
word[2]; // third character
To check whether this is right or wrong let's console those values.
console.log(word[2]);
You can try other values.
In order to access the character from back, we can use .length
method.
console.log(word[word.length - 2]); //
Note
word[word.length] will be undefined because character index starts from 0.
So for a string of length 6, 5 is the last character position.